<?php


class tx_zlib_viewhelper_link extends tx_zlib_abstract_viewhelper
{

	/**
	 * Generates a link to the current page (the caller page) using PI vars.
	 * This is the shortform of link()->thisPagePIvars().
	 *
	 * If no arguments are passed, returns a tx_zlib_viewhelper_link object.
	 *
	 * @param string $str
	 * @param array $overrulePIvars
	 * @param boolean $cache
	 * @param boolean $clearAnyway
	 * @param integer $altPageId
	 * @return string|tx_zlib_viewhelper_link
	 */
	public function link($str='', array $overrulePIvars=array(), $cache=true, $clearAnyway=true, $altPageId=0)
	{
        if (0 == func_num_args()) {
            return $this;
        }
		return $this->thisPagePIvars($str, $overrulePIvars, $cache, $clearAnyway, $altPageId);
	}

	/**
	 * Generates a link to a certain page.
	 *
	 * @param string $str The label between the a-tags
	 * @param integer $id The ID of the target page
	 * @param array $urlParameters
	 * @param string $target The value for the target attribute
	 * @return string The generated link tag
	 */
	public function toPage($str, $id, array $urlParameters=array(), $target='')
	{
		return $this->getPi()->pi_linkToPage($str, $id, $target, $urlParameters);
	}

	/**
	 * Generates a link to a certain page using PI vars.
	 *
	 * @param string $str
	 * @param integer $id
	 * @param array $overrulePIvars
	 * @param boolean $cache Using cache or not (1=cached,0=no caching)
	 * @param boolean $clearAnyway
	 * @return string The generated link tag
	 */
	public function toPagePIvars($str, $id, array $overrulePIvars=array(), $cache=true, $clearAnyway=true)
	{
		return $this->getPi()->pi_linkTP_keepPIvars($str, $overrulePIvars, $cache, $clearAnyway, $id);
	}

	/**
	 * Generates a link to the current page (the caller page).
	 *
	 * @param string $str
	 * @param array $urlParameters
	 * @param boolean $cache
	 * @param integer $altPageId
	 * @return string The generated link tag
	 */
	public function thisPage($str, array $urlParameters=array(), $cache=true, $altPageId=0)
	{
		return $this->getPi()->pi_linkTP($str, $urlParameters, $cache, $altPageId);
	}

	/**
	 * Generates a link to the current page (the caller page) using PI vars.
	 *
	 * @param string $str
	 * @param array $overrulePIvars
	 * @param boolean $cache
	 * @param boolean $clearAnyway
	 * @param integer $altPageId
	 * @return string The generated link tag
	 */
	public function thisPagePIvars($str, array $overrulePIvars=array(), $cache=true, $clearAnyway=true, $altPageId=0)
	{
		return $this->getPi()->pi_linkTP_keepPIvars($str, $overrulePIvars, $cache, $clearAnyway, $altPageId);
	}

}


if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/zlib/views/helpers/class.tx_zlib_viewhelper_link.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/zlib/views/helpers/class.tx_zlib_viewhelper_link.php']);
}
